/*
 * author: VDaras
 */

#ifndef CAMERA_H
#define CAMERA_H

#include "Rect.h"
#include <SDL/SDL.h>

class ScriptRegister;

/**
 * This class handles which portion of the game is going
 * to be blitted on the screen. For this purpose it holds an
 * Math::Rect in order to do proper clipping
 */
class Camera 
{
private:
    
    /**
     * The viewing clip of this camera.
     * The origin of this clip is the focus of the camera.
     */
    Math::Rect m_clip;
    
    /**
     * Origin + (width,Height) <= (borderX,borderY)
    */
    int m_xBorder, m_yBorder;
    
public:
    
    Camera(int x, int y, int width, int height);
    
    Camera(const Camera& c);
    
    ~Camera();

    /**
     * Moves camera's focus at x,y
     * @param x
     * @param y
     */
    void SetFocus(int x, int y);
    
    /**
     * Sets camera's borders. Setting focus or moving the camera beyond
     * this border is not possible.
     * @param maxX
     * @param maxY
     */
    void SetBorders(int maxX, int maxY); //sets camera borders
    
    /**
     * Moves camera's focus from current to current += (x,y)
     * @param x
     * @param y
     */
    void Move(int x, int y);
    
    const Math::Vector2F GetFocus();
    
    const Math::Rect *GetRect() const;
};

#endif
